﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KingOfCSharp.iHunter
{
    class ChannelProviderWrapper : PluginWrapper, IChannelProvider
    {
        IChannelProvider channelProvider;

        public ChannelProviderWrapper(IChannelProvider channelProvider)
            :base(channelProvider)
        {
            this.channelProvider = channelProvider;
        }



        #region IChannelProvider Members

        public IChannel CreateChannelInstance(ChannelInfo channelInfo)
        {
            try
            {
                return channelProvider.CreateChannelInstance(channelInfo);
            }
            catch (Exception e)
            {
                this.OnPluginError(e);
                return null;
            }
        }

        //public Type MessageViewerType
        //{
        //    get
        //    {
        //        try
        //        {
        //            return channelProvider.MessageViewerType;
        //        }
        //        catch (Exception e)
        //        {
        //            this.OnPluginError(e);
        //            return null;
        //        }
        //    }
        //}

        //public Type NewMessageEditorType
        //{
        //    get
        //    {
        //        try
        //        {
        //            return channelProvider.NewMessageEditorType;
        //        }
        //        catch (Exception e)
        //        {
        //            this.OnPluginError(e);
        //            return null;
        //        }
        //    }
        //}

        //public Type ReplyMessageEditorType
        //{
        //    get
        //    {
        //        try
        //        {
        //            return channelProvider.ReplyMessageEditorType;
        //        }
        //        catch (Exception e)
        //        {
        //            this.OnPluginError(e);
        //            return null;
        //        }
        //    }
        //}

        #endregion
        public System.Windows.Forms.UserControl GetChannelConfigureEditor()
        {
            try
            {
                return channelProvider.GetChannelConfigureEditor();
            }
            catch (Exception e)
            {
                this.OnPluginError(e);
                return null;
            }
        }

        public System.Windows.Forms.UserControl[] GetNewChannelWizardPages()
        {
            try
            {
                return channelProvider.GetNewChannelWizardPages();
            }
            catch (Exception e)
            {
                this.OnPluginError(e);
                return null;
            }
        }

        #region IChannelProvider 成员


        public Guid NewMesssageEditorGuid
        {
            get
            {
                try
                {
                    return channelProvider.NewMesssageEditorGuid;
                }
                catch (Exception e)
                {
                    this.OnPluginError(e);
                    return KingOfCSharp.iHunter.UI.HtmlEditorProvider.Guid;
                }
            }
        }

        #endregion
    }
}
